package com.xiaoyun.ba03;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("student3")
public class Student {
    private String name;
    private int age;

    /*@Autowired   spring提供的注解  给引用类型赋值 ，使用自动注入原理  byType规则
    * 可以在属性或set方法上使用*/
    @Autowired
    private School school;
    public Student() {
    }

    public void setName(String name) {
        this.name = name;
    }
    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", school=" + school +
                '}';
    }
}
